﻿@model dynamic

@{
	ViewBag.Title = "住院床卡打印";
	Layout = "~/Views/Shared/_Form.cshtml";
}
<style type="text/css">
	.border {
		border: 1px solid grey;
	}

	.center {
		text-align: center;
		width: 100%;
	}

	.text_border {
		border: none;
		background-color: none;
	}
</style>

<div style="position:fixed;top:321px;left:50px;cursor:pointer;">
	<img id="print" src="@SiteUrl.GetStaticResourceScriptUrl("~/img/print.png")" title="打印" alt="打印" />
</div>

<form id="form1">
	<div class="panel panel-default" style="padding-right:10px;">
		<table class="form">
			<tr rowspan="4">
				<td class="formValue border center" colspan="3" rowspan="2" style="border-bottom:none;font-size:20px;font-weight:bold;">
					<input id="xh" name="xh" type="text" class="text_border " style="width:100%" />
				</td>
				<td class="formValue border center" colspan="6" rowspan="5" style="font-size:40px;font-weight:bold;">
					<input id="xm" name="xm" type="text" class="text_border center" readonly="readonly" />
				</td>
				<td class="formValue border center" colspan="3" style="border-bottom:none;">性别</td>

			</tr>
			<tr>
				<td class="formValue border center" colspan="3" style="border-top:none;">

					<input id="sex" name="sex" type="text" class="border text_border center" readonly="readonly" />
				</td>
			</tr>
			<tr rowspan="2">
				<td class="formValue border center" colspan="3" rowspan="3" style="border-top:none;">
					<input id="jb" name="jb" type="text" class="text_border " style="width:100%" />
				</td>
			</tr>
			<tr>
				<td class="formValue border center" colspan="3" style="border-bottom:none;">年龄</td>
			</tr>
			<tr>
				<td class="formValue border center" colspan="3" style="border-top:none;">
					<input id="nl" name="nl" type="text" class="border text_border center" readonly="readonly" />
				</td>

			</tr>
			<tr>
				<td class="formValue border " colspan="6">
					入院日期:
					<input id="ryrq" name="ryrq" type="text" class="text_border " readonly="readonly" />
				</td>
				<td class="formValue border" colspan="6">
					ID号:
					<input id="patid" name="patid" type="text" class="text_border" readonly="readonly" />
				</td>
			</tr>
			<tr>
				<td class="formValue border" colspan="6">
					主管医生:
					<input id="ysgh" name="ysgh" type="text" class="text_border " readonly="readonly" />
				</td>
				<td class="formValue border" colspan="6">
					住院号:
					<input id="zyh" name="zyh" type="text" class="text_border " readonly="readonly" />
				</td>
			</tr>
			<tr>
				<td class="formValue border" colspan="6">
					责任护士:
					<input id="zrhs" name="zrhs" type="text" class="text_border" />
				</td>
				<td class="formValue border" colspan="6">
					责任组长:
					<input id="zrzz" name="zrzz" type="text" class="text_border" />
				</td>
			</tr>
			<tr>
				<td class="formValue border" colspan="12">
					过敏史:
					<input id="gms" name="gms" type="text" class="text_border" />
				</td>

			</tr>
			<tr>
				<td class="formValue border" colspan="12">
					费别属性:
					<select id="fbsx" name="fbsx">
						<option value="1">自费</option>
						<option value="2">医保</option>
					</select>
				</td>
			</tr>

			<tr>
				<td class="formValue border" colspan="4">
					上级医生:
					<input id="sjys" name="sjys" type="text" class="text_border" style="width:60%;" />
				</td>
				<td class="formValue border" colspan="4">
					护士长:
					<input id="hsz" name="hsz" type="text" class="text_border" style="width:60%;" />
				</td>
				<td class="formValue border" colspan="4">
					科主任:
					<input id="kzr" name="kzr" type="text" class="text_border" style="width:60%;" />
				</td>
			</tr>

		</table>
	</div>
</form>
<script lang="javascript">

	bindInit();
	getPatInfo();
	printPage();

	function bindInit() {
		$("#zrhs").dutyStaffFloatingSelector({
			dutyCode: 'Doctor'
		});
		$("#zrzz").dutyStaffFloatingSelector({
			dutyCode: 'Doctor'
		});
		$("#sjys").dutyStaffFloatingSelector({
			dutyCode: 'Doctor'
		});
		$("#hsz").dutyStaffFloatingSelector({
			dutyCode: 'Doctor'
		});
		$("#kzr").dutyStaffFloatingSelector({
			dutyCode: 'Doctor'
		});
	}
	function getPatInfo() {
		$.ajax({
            type: "POST",
			url: "/NurseManage/EntryRegistration/GetBedCard",
            data: { zyh:'@ViewBag.zyh' },
            dataType: "json",
            async:false,
			success: function (resp) {
				if (resp.length > 0) {
					if (resp[0].rqrq && resp[0].rqrq.length >= 10) {
						$("#ryrq").val(resp[0].rqrq.substring(0, 10));
					}
					//$("#ysgh").val(resp[0].ysgh);

					$("#xm").val(resp[0].xm);
					var sex = resp[0].sex == 1 ? "男" : "女";
					$("#sex").val(sex);
					$("#nl").val(resp[0].nl);
					//$("#ryrq").val(resp[0].rqrq);
					$("#patid").val(resp[0].blh);
					$("#ysgh").val(resp[0].zgysname);
					$("#zyh").val(resp[0].zyh);

					$("#zrhs").val(resp[0].zrhsname);
					$("#zrzz").val(resp[0].zrzzname);
					$("#gms").val(resp[0].gms);
					$("#fbsx").val(resp[0].fbsx);
					$("#sjys").val(resp[0].sjysname);
					$("#hsz").val(resp[0].hszname);
					$("#kzr").val(resp[0].kzrname);
					$("#xh").val(resp[0].xh);
					$("#jb").val(resp[0].jb);
				}
            }
        })
	}

	function SavaBedCard() {
		var zrhs = $("#zrhs").attr("data-StaffGh");
		var zrzz = $("#zrzz").attr("data-StaffGh");
		var gms = $("#gms").val();
		var fbsx = $("#fbsx").val();
		var sjys = $("#sjys").attr("data-StaffGh");
		var hsz = $("#hsz").attr("data-StaffGh");
		var kzr = $("#kzr").attr("data-StaffGh");
		var xh = $("#xh").val();
		var jb = $("#jb").val();
		var entity = {
			zrhs: zrhs,
			zrzz: zrzz,
			gms: gms,
			fbsx: fbsx,
			sjys: sjys,
			hsz: hsz,
			kzr: kzr,
			xh: xh,
			jb: jb,
		}
		$.ajax({
            type: "POST",
			url: "/NurseManage/WardMaintenance/SavaBedCard",
			data: {
				entity: entity,
				zyh: '@ViewBag.zyh'
			},
            dataType: "json",
            async:false,
            success: function () {
                $.modalAlert("保存成功", 'warning');
            }
		})
	}

	function printPage() {
		$('#print').click(function () {
			$('#print').hide();
			window.print();
		});

		$(document).click(function () {
			$('#print:hidden').show();
		});
	}

</script>